1 REM The IBM Personal Computer Comm
2 REM Version 1.00 (C)Copyright IBM Corp 1981
3 REM Licensed Material - Program Property of IBM
4 REM Author - M. C. Rojas
10 KEY OFF: SCREEN 0,0: WIDTH 40: COLOR 7,0: CLS:POKE 106,0
11 FOR I=1 TO 10:KEY I,"":NEXT
12 CLOSE: DEFINT A-Z: FALSE=0: TRUE=NOT FALSE: XOFF$=CHR$(19): XON$=CHR$(17):ON ERROR GOTO 460:T=0:ECH$=""
15 DEF SEG=0: IF (PEEK(&H410) AND &H30)=&H30 THEN WIDTH 80:T=20:MODE$="b":DEF SEG:GOTO 30
16 FOR I=1 TO 10:KEY I,"":NEXT
17 LOCATE 25,10+T/2:PRINT"F1 = 40 COLUMN         F2 = 80 COLUMN"
18 DEF SEG
30 WIDTH "com1:",255:DEF SEG
40 LOCATE 2: PRINT TAB(10+T) "COMMUNICATIONS MENU"
50 LOCATE 6,3+T: PRINT "Choose one of the following:"
60 LOCATE 9,10+T: PRINT "1 Description of program"
70 PRINT TAB(10+T) "2 Dow Jones/News Retrieval"
80 PRINT TAB(10+T) "3 IBM Personal Computer"
90 PRINT TAB(10+T) "4 Series/1"
100 PRINT TAB(10+T) "5 THE SOURCE"
110 PRINT TAB(10+T) "6 Other service"
115 PRINT TAB(10+T) "7 End program"
120 LOCATE 18: PRINT SPACE$(40+T): LOCATE 18,3+T,1:PRINT "choice";
122 A$=INKEY$:IF A$="" THEN 122
123 IF LEN(A$)=1 THEN LT=VAL(A$):GOTO 130
124 IF MODE$="b" THEN LT=0:GOTO 130
125 B$=MID$(A$,2,1)
126 IF ASC(B$)=59 THEN WIDTH 40:T=0:CLS:GOTO 17 ELSE IF ASC(B$)=60 THEN WIDTH 80:T=20:CLS:GOTO 17 ELSE LT=0:GOTO 130
127 GOTO 122
130 IF LT=7 THEN CLS: PRINT TAB(10+T) "- COMMUNICATION ENDED -": END ELSE IF (LT=2 OR LT=4 OR LT=5) THEN 230 ELSE IF LT=1 THEN GOSUB 530:GOTO 10:ELSE IF (LT<1 OR LT>7) THEN FL=1: PRINT: PRINT TAB(3+T) "Invalid choice, try again"
140 IF FL=1 THEN FOR I=1 TO 2500: NEXT: LOCATE 19: PRINT SPACE$(40+T):FL=0: GOTO 120
145 CLS: LOCATE 1,10+T: PRINT "USER DEFINED LINK":IF LT=3 THEN LOCATE ,3+T: PRINT "TO ANOTHER IBM PERSONAL COMPUTER"
150 LOCATE 4,3+T,1:PRINT "BAUD RATE ";:GOSUB 465: SPEED$=B$
160 LOCATE 5,3+T,1:PRINT "PARITY ";:GOSUB 465: PARITY$=B$
170 LOCATE 6,3+T,1:PRINT "NUMBER OF BITS PER CHARACTER ";:GOSUB 465:BITS$=B$
180 LOCATE 7,3+T,1:PRINT "NUMBER OF STOP BITS ";:GOSUB 465: STP$=B$
185 LOCATE 8,3+T,1:PRINT "CHARACTERS ECHOED TO SCREEN (Y/N) ";:GOSUB 465: ECH$=B$
190 LOCATE 10,3+T,1: PRINT "Data entered correctly (Y/N) ";:GOSUB 465:CR$=B$
200 IF CR$="N" OR CR$="n" THEN 145 ELSE GOSUB 480
210 LOCATE 21,3:COMFIL$="COM1:"+SPEED$+","+PARITY$+","+BITS$+","+STP$
220 OPEN COMFIL$ AS #1
230 IF LT=4 THEN NM$="Series/1":GOSUB 470:OPEN "com1:300,e,7,2" AS 1
240 IF LT=2 THEN NM$="Dow Jones News/Retrieval":GOSUB 470:OPEN "com1:300,e,7" AS 1
250 IF LT=5 THEN NM$="THE SOURCE":GOSUB 470:OPEN "com1:300,e,7" AS 1
260 OPEN "SCRN:" FOR OUTPUT AS #2
270 LOCATE ,,1
280 PAUSE=FALSE:ON ERROR GOTO 460
290 B$=INKEY$:IF B$="" THEN 320
300 IF LEN(B$)>1 THEN IF ASC(MID$(B$,2,1))=68 THEN 450 ELSE 320 ELSE IF B$=CHR$(8) THEN LOCATE ,POS(0)-1,1:PRINT " ";:LOCATE ,POS(0)-1,1
310 PRINT #1,B$;: IF ECH$="Y" OR ECH$="y" THEN PRINT#2,B$;
320 IF EOF(1) THEN 290
330 IF LOC(1)>128 THEN PAUSE=TRUE:PRINT#1,XOFF$;
340 A$=INPUT$(LOC(1),#1)
360 FOR I=1 TO LEN(A$)
370 IF (ASC(MID$(A$,I,1))<31 AND MID$(A$,I,1)<>CHR$(13)) OR MID$(A$,I,1)=CHR$(127) THEN 410
380 IF MID$(A$,I,1)=CHR$(10) THEN MID$(A$,I,1)=" "
400 PRINT MID$(A$,I,1);
410 NEXT I
420 IF LOC(1)>0 THEN 290
430 IF PAUSE THEN PAUSE=FALSE:PRINT#1,XON$;
440 GOTO 290
450 POKE 106,0: CLOSE: ON ERROR GOTO 0: GOTO 10
460 IF ERR=68 THEN CLS: LOCATE 12,8+T: PRINT "THIS PROGRAM REQUIRES THE":PRINT TAB(3+T) "ASYNCHRONOUS COMMUNICATIONS ADAPTER.": END
461 IF ERR=24 THEN CLS: LOCATE 12,,1:PRINT "A DEVICE TIMEOUT ERROR HAS OCCURRED.":PRINT "MAKE SURE THE HARDWARE IS CORRECTLY":PRINT "SET UP, THEN PRESS ENTER.";:GOSUB 465: CLS:RESUME
462 RESUME
465 A$="":B$="":CR$="": WHILE A$<>CHR$(13)
466 A$=INKEY$: IF A$="" THEN 466 ELSE IF LEN(A$)>1 THEN IF ASC(MID$(A$,2,1))=68 THEN 450 ELSE 466: ELSE IF A$<>CHR$(8) THEN PRINT A$;: ELSE LOCATE ,POS(0)-1,1:PRINT " ";:LOCATE ,POS(0)-1,1:B$=MID$(B$,1,LEN(B$)-1)
467 IF A$<>CHR$(13) AND A$<>CHR$(8) THEN B$=B$+A$
468 WEND:RETURN
470 CLS: LOCATE 1,12+T: PRINT NM$:PRINT
480 PRINT:PRINT:PRINT TAB(3+T) "- Place your call, and insert the"
490 PRINT TAB(3+T) "  phone receiver into the modem, or"
495 PRINT TAB(3+T) "  switch your data set from talk to"
500 PRINT TAB(3+T) "  data. Then press ENTER to begin.   ": PRINT: PRINT
510 PRINT TAB(3+T) "- PRESS F10 TO GO TO MENU":PRINT
512 GOSUB 465
515 RETURN
530 CLS: LOCATE 1,15+T: PRINT "DESCRIPTION"
540 LOCATE 4,3+T: PRINT "An asynchronous communication link"
550 PRINT TAB(3+T) "will be established between the"
560 PRINT TAB(3+T) "selected service and the"
570 PRINT TAB(3+T) "IBM PERSONAL COMPUTER, as follows:"
580 LOCATE 9,3+T: PRINT "Baud rate";TAB(13+T)"300"
590 PRINT TAB(3+T) "Parity";TAB(14+T)"E"
600 PRINT TAB(3+T) "Data bits";TAB(14+T);"7
610 PRINT TAB(3+T) "Stop bits";TAB(14+T);"1  Dow Jones, THE SOURCE"
620 PRINT TAB(14+T) "2  Series/1"
630 LOCATE 15,3+T: PRINT "Options 3 and 6 allow for the above"
640 PRINT TAB(3+T) "characteristics to be supplied by"
650 PRINT TAB(3+T) "the user to define a communication"
660 PRINT TAB(3+T) "link to other services or computers."
661 IF MODE$="b" THEN 670
665 LOCATE 20,3+T: PRINT "You can select 40 column display or"
666 PRINT TAB(3+T) "80 column display by pressing F1 or"
667 PRINT TAB(3+T) "F2 before selecting menu choice."
670 LOCATE 24,3+T: PRINT "PRESS ANY KEY TO GO TO MENU";
671 CR$=INKEY$:IF CR$="" THEN 671 ELSE RETURN
